<template>
  <div class="titlebtn" :style="style" @click="fclick" />
</template>

<script>
// import { ipcRenderer } from "electron"

// const { ipcRenderer } = require('electron')
// const ipcRenderer = window.require("electron").ipcRenderer;
const style = {
  min: {
    backgroundColor: "yellow",
    borderRadius: "50%",
    right: "70px",
  },
  max: {
    backgroundColor: "green",
    borderRadius: "50%",
    right: "40px",
  },
  close: {
    backgroundColor: "red",
    borderRadius: "50%",
    right: "10px",
  },
};
export default {
  name: "Titlebtn",
  props: ["type"],
  computed: {
    style() {
      return style[this.type];
    },
  },
  methods: {
    async fclick() {
      // ipcRenderer.send(this.type);
      // window.ipcRenderer.send(this.type);
      const detail = await ipcRenderer.invoke(this.type, 'data');
      // const detail = await ipcRenderer.send(this.type);
      // console.log(this.type);
      // this.$electron.ipcRenderer.send(this.type,'我是渲染进程里面的数据')
      // ipcRenderer.invoke(this.type, 1)
    },
  },
};
</script>
    
<style scoped>
.titlebtn {
  position: absolute;
  width: 15px;
  height: 15px;
  top: 0.5rem;
  /* bottom: 0; */
  margin: auto 0;
  -webkit-app-region: no-drag;
}
</style>